package com.java.base;
import java.util.Scanner;
import java.lang.Math;
public class PlayThunder {
	static int r,c;
	static int[][] thunder;
	static int n;
	public static void main(String[] args) {
		
		Scanner sca =new Scanner(System.in);
		while(true){
			System.out.print( "请输入布雷面板的行:");
			r=sca.nextInt();
			System.out.print("请输入布雷面板的宽:");
			c =sca.nextInt();
			System.out.print("请输入雷的个数:");
			int n=sca.nextInt();
			thunder=new int[r][c];
			System.out.println("\n");
			PlayThunder.louyThunder(n);
			String str=sca.next();
			if(str.equalsIgnoreCase("N")){
				break;
			}
		}

		


	}
	public static void louyThunder(int n){
		int a,b;
		if(n>0&&n<r*c*0.75){
			int k=0;
			while(k<n){
				a=(int)(Math.random()*r);
				b=(int)(Math.random()*c);
				thunder[a][b]=-1;
				k++;
			}
			PlayThunder.printThunder();
		}else{
			System.out.println("对不起，你输入的雷数超出范围！");
			System.out.println("你想重新开始吗？(Y/N)");
		}

		
	}
	public static void printThunder(){
		for(int i=0;i<thunder.length;i++){
			for(int j=0;j<thunder[i].length;j++){
				if(thunder[i][j]==-1){
					System.out.print(thunder[i][j]+"\t");
				}else{
					System.out.print("   "+thunder[i][j]+"\t");
				}
				
			}
			System.out.println();
		}
		
	}

}
